﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kimola
{
  /// <summary>
  /// A class that holds information about the document that will be indexed.
  /// </summary>
  public class KDocument
  {
    /// <summary>
    /// Initializes a new instance of the <see cref="KDocument"/> class.
    /// </summary>
    internal KDocument()
    {
      this.Fields = new Dictionary<string, string>();
    }

    /// <summary>
    /// Gets or sets the document URL. This is the unique field which identifies all documents.
    /// </summary>
    /// <value>
    /// The URL of the document. Must be unique.
    /// </value>
    public string Url { get; set; }

    /// <summary>
    /// Gets or sets the partspace of the document. Partspaces can be used to seperate indexed documents like categorizing.
    /// eg. 'news', 'articles' etc.
    /// </summary>
    /// <value>
    /// The partspace name.
    /// </value>
    public string PartSpace { get; set; }

    /// <summary>
    /// Gets or sets the title of the document.
    /// </summary>
    /// <value>
    /// The title of the document.
    /// </value>
    public string Title { get; set; }

    /// <summary>
    /// Gets or sets the document content. Each word in this field will be indexed for this document with a calculated correlation value
    /// </summary>
    /// <value>
    /// The document content.
    /// </value>
    public string Content { get; set; }

    /// <summary>
    /// Gets or sets the image URL of the document if exists.
    /// </summary>
    /// <value>
    /// The image URL.
    /// </value>
    //public string ImageUrl { get; set; }

    /// <summary>
    /// Gets or sets the special fields as key-value pairs related to document if exists.
    /// A field's key or value text doesn't affect search results.
    /// Fields can be used to show additional information about the document when shown on UI.
    /// </summary>
    /// <value>
    /// Key values pairs
    /// </value>
    public Dictionary<string, string> Fields { get; set; }

    /// <summary>
    /// The words specified in this field affect search results but not shown to end-user. It is especially useful when
    /// used with text content less then 25 words.
    /// </summary>
    /// <value>
    /// The document tag.
    /// </value>
    public string Tag { get; set; }

    /// <summary>
    /// Gets or sets the document's date of creation. If left <paramref name="null"/>, it will be set to current <see cref="DateTime"/>.
    /// </summary>
    /// <value>
    /// The document date.
    /// </value>
    public DateTime DocumentDate { get; set; }

    /// <summary>
    /// Gets or sets the culture code of the documnet. This value will be read from <see cref="Kimola Configuration Section"/> by default.
    /// It's important to set this value correctly for each document's culture because of its vital importance on calculating
    /// correlation values for indexing words.  
    /// </summary>
    /// <value>
    /// The culture code. eg. 'en-GB', 'tr-Tr'
    /// </value>
    public string Culture { get; set; }
  }
}